<?php
/**
 * 对象转json
 * User: Administrator
 * Date: 2017/12/6
 * Time: 15:02
 */
class Emp {
    public $name = "";
    public $hobbies  = "";
}
$e = new Emp();
$e->name = "sachin";
$e->hobbies  = "sports";

echo json_encode($e);
?>